package com.megvii.livenesslib.util;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;

import com.megvii.livenesslib.LivenessActivity;

import cn.pedant.SweetAlert.SweetAlertDialog;

public class DialogUtil {

	private Activity activity;

	public DialogUtil(Activity activity) {
		this.activity = activity;
	}

	public void showDialog(String message) {
		SweetAlertDialog dialog = new SweetAlertDialog(activity, SweetAlertDialog.WARNING_TYPE);
		dialog.setTitleText("错误提示")
				.setContentText(message);
		dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
			@Override
			public void onDismiss(DialogInterface dialogInterface) {
				activity.finish();
			}
		});
		dialog.setCancelable(false);
		dialog.setConfirmText("确认");
		dialog.show();
	}

	public void onDestory() {
		activity = null;
	}
}